package com.woniuxy.controller;

import com.woniuxy.service.MenuService;
import com.woniuxy.util.ResponseData;
import com.woniuxy.util.UserContext;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

/**
 * @author ：CuiYC
 * @description：
 * @date ：Created in 2025/3/27 9:26
 * @modified By：
 */
@RestController
@RequestMapping("/menu")
@AllArgsConstructor
public class MenuController {
    private MenuService menuService;
    @GetMapping("/queryMenu")
    public ResponseData<?> getUserMenuList(){
        try {
            Integer userId = UserContext.getUserId();
            return menuService.getUserMenuList(userId);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
}
